package com.airbat.prize.common.enums;

import com.airbat.prize.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 收藏夹类型
 */
@Getter
@AllArgsConstructor
public enum FavoritesTypeEnum implements IntArrayValuable {

    //数据类型 1人员关系拓扑 2人案关系拓扑 3案（事）件关系拓扑 4....
    PERSON_RELATION(1, "人员关系拓扑"),
    PERSON_RELATION_KEY(11, "人员关系拓扑关键字"),
    PERSON_CASE_RELATION(2, "人案关系拓扑"),
    PERSON_CASE_RELATION_KEY(21, "人案关系拓扑关键字"),
    EVENT_CASE_RELATION(3, "案（事）件关系拓扑"),
    EVENT_CASE_RELATION_KEY(31, "案（事）件关系拓扑关键字"),
    ONE_SEARCH(4, "一键智搜"),
    EVENT_SEARCH(5, "事件搜索");

    /**
     * 值
     */
    private final Integer value;
    /**
     * 名称
     */
    private final String name;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(FavoritesTypeEnum::getValue).toArray();

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static FavoritesTypeEnum getEnum(long value) {
        return Arrays.stream(values()).filter(tr -> tr.getValue() == value).findFirst().get();
    }

}
